home *** CD-ROM | disk | FTP | other *** search
- Subject: sending AEevents from container to embedded parts
- Sent: 8/6/96 8:03 AM
- Received: 8/6/96 8:53 AM
- From: Pamela J Hayes, phayes@umich.edu
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
-
- I am trying to set properties of embedded parts from the containing
- part. I used the advice given in the Scripting engineering note and
- added the HasProperty(), SetProperty(), and GetProperty() methods to my
- embedded part.
-
- I also followed the advice given in the OpenDoc ProgrammerUs Guide by
- using the ODMessageInterface class and its CreatePartAddrDesc(),
- CreateEvent(), and CreatePartObjSpec() methods to create my AppleEvent.
- I also added to the embedded part an TaeteU resource describing the
- TsetdU event and the corresponding properties.
-
- But when I send the AppleEvent to the proxy part, I get OSErr -1728
- (errAENoSuchObject). Being a novice to AppleEvents, I donUt know where
- exactly I have made an error - in my direct object specifier, in my
- TaeteU resource (which I am not even sure is necessary?), or in my
- embedded partUs *Property() methods.
-
- Below is the method which creates and sends the AppleEvent. Thanks for
- any help anybody can give!
-
- Pam
-
- -------
-
- void ChangeProxyColorScheme (Environment* ev,
- CProxy* proxy,
- long colorScheme,
- CChecklistPart* part)
- {
- // Get message interface object
- ODMessageInterface* msgInt = part->GetSession(ev)->GetMessageInterface(ev);
-
- // Get the address of the embedded part
- FW_CDesc partAddress;
- ODPart* embeddingPart = part->GetODPart(ev);
- msgInt->CreatePartAddrDesc (ev, partAddress, embeddingPart);
-
- // Create a set-data event
- FW_CAppleEvent event;
- ODSShort result = msgInt->CreateEvent (ev, kAECoreSuite, kAESetData,
- partAddress, 0, event);
-
- // The part
- ODObjectSpec* spec (NULL);
- ODPart* embeddedPart = proxy->AcquireEmbeddedPart(ev);
- msgInt->CreatePartObjSpec (ev, &spec, embeddedPart);
- FW_CDesc partSpec (spec);
-
- // the property
- FW_CDesc propIDSpec;
- propIDSpec.PutType (pColorScheme);
-
- // Prop of thePart
- FW_CDesc theSpec;
- FW_CreateObjSpecifier (cProperty, partSpec, formPropertyID, propIDSpec,
- theSpec);
-
- // The data to set "it" to
- FW_CDesc newValue;
- newValue.PutLongInteger (colorScheme);
-
- // Add parameters to Apple event
- OSErr err;
- err = AEPutParamDesc (event, keyDirectObject, theSpec);
- err = AEPutParamDesc (event, keyAEData, newValue);
-
- // Send the event
- FW_CAppleEvent reply;
- FW_CEmbeddingFrame* embeddingFrame = (FW_CEmbeddingFrame*)
- part->GetFrame();
- ODFrame* embeddedFrame = proxy->AcquireEmbeddedFrame (ev,
- embeddingFrame); // target?
-
- /* Commented out so I can get the OSErr
- msgInt->Send (ev, embeddedFrame, embeddingPart, event, reply,
- kAENoReply,
- kAENormalPriority,
- 120);
-
- err = AESend (event, reply,
- kAENoReply,
- kAENormalPriority,
- 120, (AEIdleUPP)kODNULL,
- (AEFilterUPP)kODNULL);
- }
-
-
-